#!/usr/local/bin/python3
# -*- coding:utf8 -*-
# Author Aaron
# 2017-04-02 21:41:53
import time
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
global val 
val = False
reset = 7
switch1 = 11
switch2 = 13
switch3 = 15

yello = 12
green = 16
red = 18
GPIO.setmode(GPIO.BOARD)
GPIO.setup(reset,GPIO.IN)
GPIO.setup(switch1,GPIO.IN)
GPIO.setup(switch2,GPIO.IN)
GPIO.setup(switch3,GPIO.IN)
GPIO.setup(yello,GPIO.OUT)
GPIO.setup(green,GPIO.OUT)
GPIO.setup(red,GPIO.OUT)
def resetLed():
    GPIO.output(yello,GPIO.LOW)
    GPIO.output(green,GPIO.LOW)
    GPIO.output(red,GPIO.LOW)
    
def loop():
    global val
    while True:
        resetVal = GPIO.input(reset)
        if resetVal == GPIO.HIGH:
            val = False;
            resetLed()
            continue 
        if val:
            continue
        print("hello   ")
        yelloVal = GPIO.input(switch1)
        greenVal = GPIO.input(switch2)
        redVal = GPIO.input(switch3)
        if yelloVal == GPIO.HIGH:        
            val = True
            GPIO.output(yello,GPIO.HIGH)
        if greenVal == GPIO.HIGH:
            val = True
            GPIO.output(green,GPIO.HIGH)
        if redVal == GPIO.HIGH:
            val= True
            GPIO.output(red,GPIO.HIGH)
        #time.sleep(0.2)  
loop()

GPIO.cleanup()
